/*
@ClassName ParamConfig
@Description TODO
@Author SubUp
@Date   2022/8/9
@Version 1.0
*/

package com.sunjob.mrojobschedule.config;

import com.sunjob.common.constant.MROConstant;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Configuration
public class ParamConfig {



    @Bean
    public Map PlanNatureParam(RedisTemplate redisTemplate){
        HashOperations hashOperations = redisTemplate.opsForHash();
        Map<String,String> map = new ConcurrentHashMap<>();
        map.put("0","定时检查");
        map.put("1","定时修理");
        map.put("2","普查改造");
        map.put("3","故障处理");
        hashOperations.putAll(MROConstant.SCHEDULE_PLAN_NATURE,map);
        return map;
    }
    @Bean
    public Map ExamineConditionStateParam(RedisTemplate redisTemplate){
        HashOperations hashOperations = redisTemplate.opsForHash();
        Map<String,String> map = new ConcurrentHashMap<>();
        map.put("0","历史维修记录");
        map.put("1","寿命期限");
        map.put("2","车辆年限");
        map.put("3","车辆里程");
        map.put("4","车辆故障");
        hashOperations.putAll(MROConstant.SCHEDULE_EXAMINE_CONDITION_STATE,map);
        return map;
    }
    @Bean
    public Map ExamineChoiceParam(RedisTemplate redisTemplate){
        HashOperations hashOperations = redisTemplate.opsForHash();
        Map<String,String> map = new ConcurrentHashMap<>();
        map.put("0","零件");
        map.put("1","车");
        hashOperations.putAll(MROConstant.SCHEDULE_EXAMINE_CHOICE,map);
        return map;
    }

    @Bean
    public Map ExaminePatternParam(RedisTemplate redisTemplate){
        HashOperations hashOperations = redisTemplate.opsForHash();
        Map<String,String> map = new ConcurrentHashMap<>();
        map.put("0","流程审批");
        map.put("1","自动审批");
        hashOperations.putAll(MROConstant.SCHEDULE_EXAMINE_PATTERN,map);
        return map;
    }

    @Bean
    public Map ExamineStateParam(RedisTemplate redisTemplate){
        HashOperations hashOperations = redisTemplate.opsForHash();
        Map<String,String> map = new ConcurrentHashMap<>();
        map.put("0","未审批");
        map.put("1","审批中");
        map.put("2","审批通过");
        map.put("3","审批拒绝");
        hashOperations.putAll(MROConstant.SCHEDULE_EXAMINE_STATE,map);
        return map;
    }

    @Bean
    public Map JobLevelParam(RedisTemplate redisTemplate){
        HashOperations hashOperations = redisTemplate.opsForHash();
        Map<String,String> map = new ConcurrentHashMap<>();
        map.put("0","正常任务");
        map.put("1","紧急任务");
        hashOperations.putAll(MROConstant.SCHEDULE_JOB_LEVEL,map);
        return map;
    }

    @Bean
    public Map LifeCycleStateParam(RedisTemplate redisTemplate){
        HashOperations hashOperations = redisTemplate.opsForHash();
        Map<String,String> map = new ConcurrentHashMap<>();
        map.put("0","年定检");
        map.put("1","年定修");
        map.put("2","半年定检");
        map.put("3","半年定修");
        map.put("4","月定检");
        map.put("5","月定修");
        map.put("6","周定检");
        map.put("7","周定修");
        map.put("8","自定义检修");
        hashOperations.putAll(MROConstant.SCHEDULE_LIFE_CYCLE_STATE,map);
        return map;
    }

    @Bean
    public Map ShowStateParam(RedisTemplate redisTemplate){
        HashOperations hashOperations = redisTemplate.opsForHash();
        Map<String,String> map = new ConcurrentHashMap<>();
        map.put("0","一年内");
        map.put("1","半年内");
        map.put("2","一周内");
        hashOperations.putAll(MROConstant.SCHEDULE_SHOW_STATE,map);
        return map;
    }

    @Bean
    public Map PlanStateParam(RedisTemplate redisTemplate){
        HashOperations hashOperations = redisTemplate.opsForHash();
        Map<String,String> map = new ConcurrentHashMap<>();
        map.put("0","激活");
        map.put("1","禁用");
        hashOperations.putAll(MROConstant.SCHEDULE_PLAN_STATE,map);
        return map;
    }
    @Bean
    public Map JobFeedbackParam(RedisTemplate redisTemplate){
        HashOperations hashOperations = redisTemplate.opsForHash();
        Map<String,String> map = new ConcurrentHashMap<>();
        map.put("0","发送");
        map.put("1","接收");
        map.put("2","拒绝");
        map.put("3","过期");
        map.put("4","完成");
        map.put("5","失败");
        hashOperations.putAll(MROConstant.SCHEDULE_JOB_FEEDBACK,map);
        return map;
    }
}
